package pl.edu.agh.abd.hsm;

import org.restlet.Component;
import org.restlet.data.Protocol;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
public class EstimatorService extends ServerResource {

	public static void main(String[] args) throws Exception {
		// Create a new Restlet component and add a HTTP server connector to it
		Component component = new Component();
		component.getServers().add(Protocol.HTTP, 8182);

		// Then attach it to the local host
		component.getDefaultHost().attach("/estimator", EstimatorService.class);
		//System.setProperty("java.util.logging.config.file", "/your/path/logging.config");
		// Now, let's start the component!
		// Note that the HTTP server connector is also automatically started.
		component.start();
		System.out.println("Started");

	}

	@Get("json")
	public EstimatorResponse toJson() {
		EstimatorResponse es = new EstimatorResponse();
		es.setResourceName(getReference().getRemainingPart());
		es.setResponseTime(100);
		es.setTransferTime(30);
		//JsonConverter xx = new JsonConverter();
		return es;
	}

}
